package org.example.ext;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;

@Component
public class InstantiationPostProcessor implements InstantiationAwareBeanPostProcessor {

	@Nullable
	public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
		System.out.println("初始化前：InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation");
		return null;
	}

	@Nullable
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("初始化后：BeanPostProcessor#postProcessAfterInitialization");
		return bean;
	}

}
